<template>
  <div class="card-box">
    <div class="card-head">
      <span class="head-icon"></span>
      <label>{{ props.title }}</label>
      <p v-show="props.show" @click="onClose">
        <el-icon size="24"><Close /></el-icon>
      </p>
    </div>
    <div class="card-content">
      <slot></slot>
    </div>
  </div>
</template>

<script setup lang="ts">
const props: any = defineProps({
  title: {
    type: String,
    defalut: "测试",
  },
  show: {
    type: Boolean,
    defalut: false
  }
});

const emits = defineEmits(['close']);

/**
 * 关闭
 */
const onClose = () => {
  emits('close')
}
</script>

<style lang="scss" scoped>
.card-box {
  width: 100%;
  height: 100%;
}
.card-head {
  position: relative;
  height: 30px;
  width: 100%;
  box-sizing: border-box;
  background: url("../../assets/image/head-bg.png") no-repeat 0 0;
  background-size: 100% 100%;
  font-family: YouShe, serif;
  font-style: normal;
  font-weight: 400;
  font-size: 18px;
  line-height: 24px;
  color: #eff6ff;
  text-shadow: 0 2px 4px rgb(2 7 17 / 80%);
  padding-left: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  p{
    font-weight: bold;
    cursor: pointer;
  }
}
.head-icon {
  position: absolute;
  top: -12px;
  left: 0;
  background: url("../../assets/image/head-icon.png") no-repeat 0 0;
  background-size: 100% 100%;
  width: 24px;
  height: 24px;
}
.card-content {
  height: calc(100% - 30px);
  box-sizing: border-box;
  padding: 20px;
  backdrop-filter: blur(0px) saturate(180%);
  background: linear-gradient(
    to right,
    rgba(37, 54, 54, 0.7) 0%,
    rgba(37, 54, 54, 0.5) 100%
  );
}
</style>
